/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>
#include <string>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 10;

std::string str[maxn];
std::vector<std::pair<int, int> > vec;

bool check(int x) { return x >= 0 && x <= 9; }

int main() {
  for (int i = 0; i < 9; ++i) {
    cin >> str[i];
  }
  for (int i = 0; i < 9; ++i) {
    for (int j = 0; j < 9; ++j) {
      if (str[i][j] == '#') vec.push_back({j, i});
    }
  }
  int ans = 0;
  for (auto i = 0u; i < vec.size(); ++i) {
    for (auto j = i + 1; j < vec.size(); ++j) {
      auto a = vec[i], b = vec[j];
      if (a.first > b.first) std::swap(a, b);
      if (b.second - a.second > 0) {
        if (check(a.second + (b.first - a.first)) &&
            check(a.first - (b.second - a.second)) &&
            str[a.second + (b.first - a.first)]
               [a.first - (b.second - a.second)] == '#' &&
            check(b.second + (b.first - a.first)) &&
            check(b.first - (b.second - a.second)) &&
            str[b.second + (b.first - a.first)]
               [b.first - (b.second - a.second)] == '#')
          ++ans;
        if (check(a.second - (b.first - a.first)) &&
            check(a.first + (b.second - a.second)) &&
            str[a.second - (b.first - a.first)]
               [a.first + (b.second - a.second)] == '#' &&
            check(b.second - (b.first - a.first)) &&
            check(b.first + (b.second - a.second)) &&
            str[b.second - (b.first - a.first)]
               [b.first + (b.second - a.second)] == '#')
          ++ans;
      } else {
        if (check(a.second + (b.first - a.first)) &&
            check(a.first + (a.second - b.second)) &&
            str[a.second + (b.first - a.first)]
               [a.first + (a.second - b.second)] == '#' &&
            check(b.second + (b.first - a.first)) &&
            check(b.first + (a.second - b.second)) &&
            str[b.second + (b.first - a.first)]
               [b.first + (a.second - b.second)] == '#')
          ++ans;
        if (check(a.second - (b.first - a.first)) &&
            check(a.first - (a.second - b.second)) &&
            str[a.second - (b.first - a.first)]
               [a.first - (a.second - b.second)] == '#' &&
            check(b.second - (b.first - a.first)) &&
            check(b.first - (a.second - b.second)) &&
            str[b.second - (b.first - a.first)]
               [b.first - (a.second - b.second)] == '#')
          ++ans;
      }
    }
  }
  cout << ans / 4;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("C - Counting Squares.in", "r", stdin);
  freopen("C - Counting Squares.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
